package cn.melon.view.control;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;

import cn.melon.mod.sc.ScRequest;
import cn.melon.window.MainWindow;

/**
 * 监听器，在用户点击选课按钮时，通知服务器用户的选课操作
 * @ClassName: ChooseLesson
 * @author Hzy
 */
public class ChooseLesson implements ActionListener{
    private String lessonID;
    public ChooseLesson(String lessonID){
        this.lessonID = lessonID;
    }

    @Override 
    public void actionPerformed(ActionEvent e){
        JButton btn = (JButton) e.getSource();
        MainWindow m = (MainWindow) btn.getRootPane().getParent();
//        通知服务器学生选了这门课
        ScRequest request = new ScRequest(m);
        request.addMessage(lessonID);
    }
}
